import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    component: () => import('@/views/Layout/index.vue'),
    children: [
      {
        path: '/',
        component: () => import('@/views/Home/index.vue')
      },
      {
        path: '/goods/:id',
        component: () => import('@/views/Goods/index.vue')
      },
      {
        path: '/cart',
        component: () => import('@/views/Cart/index.vue')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/Login/index.vue')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes,
  scrollBehavior: () => ({ left: 0, top: 0 })
})

export default router
